//
//  ViewController.swift
//  责任链模式
//
//  Created by 崔博 on 2017/8/10.
//  Copyright © 2017年 崔博. All rights reserved.
//

struct Message {
    let from : String
    let to : String
    let subject : String
    
}
class LocalTransmitter {
    func sendMessage(message: Message) {
        print("Message to\(message.to) sent locally)")
    }
}
class RemoteTransmitter {
    func sendMessage(message: Message) {
        print("Message to\(message.to) sent remotely)")
    }
}
import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        let messages = [Message(from: "cuibo@.com", to: "cuiboshuai@.com", subject: "Free For lunch?"),
                        Message(from: "cuibo@.com", to: "cuiboshuai@.com", subject: "Free For lunch?"),
                        Message(from: "cuibo@.com", to: "cuiboshuai@.com", subject: "Free For lunch?")]
        let locat = LocalTransmitter()
        let remote = RemoteTransmitter()
        
//        for msg in messages {
//            if let index =  {
//                <#statements#>
//            }
//        }
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

